package top.chukongxiang.dubboboot.simple.gateway.config;

import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import top.chukongxiang.dubboboot.simple.gateway.oauth2.Oauth2HttpMessageConverter;

import java.util.List;

/**
 * @author 楚孔响
 * @version 1.0
 * @date 2022/1/11 13:15
 */
@Configuration
public class WebMvcConfig extends WebMvcConfigurationSupport {

    @Override
    protected void addInterceptors(InterceptorRegistry registry) {
        super.addInterceptors(registry);
    }

    @Override
    protected void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
        converters.add(0, new Oauth2HttpMessageConverter());
        converters.add(1, new FastJsonHttpMessageConverter());
    }
}
